package com.ipartek.formacion.gestformwww.modelo.beans;

import com.ipartek.formacion.gestformwww.controlador.Verificador;
import java.sql.*;
import java.util.ArrayList;

/**
 *
 * @author Curso
 * Autor: �lvaro de la Cal
 * Fecha Creaci�n: 04/10/2010 10:30
 */

public class Calificacion {
    private int aluId;//De Alumno Relacionado con AlumCurso
    private int curId;//Relacionado con AlumCurso
    private Timestamp CalFch;
    private float calNota;
    private String calObserv;//255

public Calificacion(int aluId, int curId, Timestamp CalFch, float calNota) {
        this.aluId = aluId;
        this.curId = curId;
        this.CalFch = CalFch;
        this.calNota = calNota;
    }

    public Calificacion() {

    }
    public void setCalFch(Timestamp CalFch) {
        this.CalFch = CalFch;
    }

    public void setCalNota(float calNota) {
        this.calNota = calNota;
    }

    public void setCalNota(String calNota){
        try{
            this.calNota = Float.parseFloat(calNota);
            if (this.calNota<0 || this.calNota>10){
                this.calNota=-1;
            }
        }catch(Exception ex){
            this.calNota = -1;
        }
    }

    public void setCalObserv(String calObserv) {
        this.calObserv = calObserv;
    }

    public void setCurId(int curId) {
        this.curId = curId;
    }

    public void setAluId(int aluId) {
        this.aluId = aluId;
    }

    public Timestamp getCalFch() {
        return CalFch;
    }

    public float getCalNota() {
        return calNota;
    }

    public String getCalObserv() {
        return calObserv;
    }

    public int getCurId() {
        return curId;
    }

    public int getAluId() {
        return aluId;
    }

     public ArrayList<String> validar(){
      ArrayList<String>  errores= new ArrayList<String>();
      if(!Verificador.caracteresCorrectos(calObserv)){
            errores.add("error-observaciones");
      }
      return errores;
   }
}